@echo off
rem tools: jwasm, jwlink, jfc, ms link (COFF)
rem cd bin
rem jwasm -q -bin *.asm
rem for %%f in (*.asm) do call :cmpbin %%f
rem cd ..

cd mz
jwasm -q -mz *.asm
for %%f in (*.asm) do call :cmpmz  %%f
cd ..
cd errcoff
jwasm -q -coff -eq *.asm
for %%f in (*.asm) do call :cmperr %%f
cd ..
cd error
jwasm -q -omf -eq *.asm
for %%f in (*.asm) do call :cmperr %%f
cd ..
cd omf
jwasm -q -omf *.asm
for %%f in (*.asm) do call :cmpomf %%f 
cd ..
cd omflnk
jwasm -q -omf *.asm
for %%f in (*.asm) do call :lnkomf %%f
cd ..
cd pe
jwasm -q -pe *.asm
for %%f in (*.asm) do call :cmppe %%f
cd ..

goto :eof


:cmpbin
jfc %~n1.BIN %~n1.EXP
goto :eof

:cmpmz
jfc %~n1.EXE %~n1.EXP
goto :eof

:cmperr
jfc -t 0 %~n1.ERR %~n1.EXP
goto :eof

:cmpomf
jfc %~n1.OBJ %~n1.EXP
goto :eof

:lnkomf
jwlink op q,nofar format dos file %~n1.OBJ libpath ..\libomf
jfc %~n1.EXE %~n1.EXP
goto :eof

:cmppe
jfc -pe %~n1.EXE %~n1.EXP
goto :eof

:cmplst
jfc -t 1 %~n1.LST %~n1.EXP
goto :eof

:coff
jwasm -q -coff -safeseh SAFESEH.ASM
if errorlevel 1 goto :eof
link /nologo /SAFESEH SAFESEH.OBJ ..\libcoff\SAFESEH.LIB
jfc -pe SAFESEH.EXE SAFESEH.EXP

rem weak externals [ extern sym (altname) ...]
jwasm -q -coff EXTERN4.ASM
if errorlevel 1 goto :eof
link /nologo /subsystem:console EXTERN4.OBJ
jfc -pe EXTERN4.EXE EXTERN4.EXP

rem weak externals [ ALIAS <> = <> ]
jwasm -q -coff EXTERN11.ASM
if errorlevel 1 goto :eof
jfc -co EXTERN11.OBJ EXTERN11.EXP

rem ALIAS segment attribute
jwasm -q -coff SEGALIAS.ASM
if errorlevel 1 goto :eof
jfc -co SEGALIAS.OBJ SEGALIAS.EXP

rem ALIGN and characteristics segment attributes
jwasm -q -coff -eq SEGALIGN.ASM
jfc -t 0 SEGALIGN.ERR SEGALIGN.EXP

rem 64-bit dll
jwasm -q -coff DLL64.ASM
if errorlevel 1 goto :eof
jfc -co DLL64.OBJ DLL64.EXP

jwasm -q -coff SEH64.ASM
if errorlevel 1 goto :eof
jfc -co SEH64.OBJ SEH64.EXP

jwasm -q -coff SEH642.ASM
if errorlevel 1 goto :eof
jfc -co SEH642.OBJ SEH642.EXP

jwasm -q -win64 MOV643.ASM
if errorlevel 1 goto :eof
jfc -co MOV643.OBJ MOV643.EXP

jwasm -q -win64 PROC641.ASM
if errorlevel 1 goto :eof
jfc -co PROC641.OBJ PROC641.EXP

jwasm -q -coff PROC643.ASM
if errorlevel 1 goto :eof
jfc -co PROC643.OBJ PROC643.EXP

rem option dllimport
jwasm -q -coff -Fd DLLIMP.ASM
if errorlevel 1 goto :eof
jwlink2 format win pe f DLLIMP.OBJ op q,noreloc
jfc -pe DLLIMP.EXE DLLIMP.EXP

rem unsupported directives in COFF
jwasm -q -coff -eq UNSUPP1.ASM
jfc -t 0 UNSUPP1.ERR UNSUPP1.EXP

jwasm -q -coff DATA10.ASM
if errorlevel 1 goto :eof
jfc -co DATA10.OBJ DATA10.EXP

jwasm -q -coff COFFOP.ASM
if errorlevel 1 goto :eof
jfc -co COFFOP.OBJ COFFOP.EXP

rem invalid operands for COFF operators
jwasm -q -coff -eq COFFOP2.ASM
jfc -t 0 COFFOP2.ERR COFFOP2.EXP

rem invalid segment attribute (ALIAS) changes
jwasm -q -coff -eq ALIAS2.ASM
jfc -t 0 ALIAS2.ERR ALIAS2.EXP

rem COMDAT errors
jwasm -q -coff -eq COMDAT1.ASM
jfc -t 0 COMDAT1.ERR COMDAT1.EXP

rem COMDAT object module
jwasm -q -coff COMDAT2.ASM
jfc -co COMDAT2.OBJ COMDAT2.EXP

rem 64-bit SEH unwind errors
jwasm -q -coff -eq PROC644.ASM
jfc -t 0 PROC644.ERR PROC644.EXP

rem CV4 debug info and multiple code sections 
jwasm -q -coff -Zi CVCOFF1.ASM
jfc -co CVCOFF1.OBJ CVCOFF1.EXP

jwasm -q -coff PROC645.ASM
if errorlevel 1 goto :eof
jfc -co PROC645.OBJ PROC645.EXP

jwasm -q -coff COFF1.ASM
if errorlevel 1 goto :eof
jfc -co COFF1.OBJ COFF1.EXP

jwasm -q -Zi -coff DBGCV.ASM
if errorlevel 1 goto :eof
jfc -co DBGCV.OBJ DBGCV.EXP

goto :eof

:elf
jwasm -q -elf ELF1.ASM
if errorlevel 1 goto :eof
jfc ELF1.OBJ ELF1.EXP
goto :eof

:div
jwasm -q -eq -Zne OVERRID3.ASM
jfc -t 0 OVERRID3.ERR OVERRID3.EXP

jwasm -q -Zg -bin LOCAL3.ASM
jfc LOCAL3.BIN LOCAL3.EXP

jwasm -q -Zg -bin INVOKE21.ASM
jfc INVOKE21.BIN INVOKE21.EXP

jwasm -q -Zg -bin HLL4.ASM
jfc HLL4.BIN HLL4.EXP

jwasm -q -Zg -omf OPATTR10.ASM
jfc OPATTR10.OBJ OPATTR10.EXP

jwasm -q -Zd -omf LINNUM.ASM
jfc LINNUM.OBJ LINNUM.EXP

jwasm -q -eq -bin STARTUP4.ASM
jfc -t 0 STARTUP4.ERR STARTUP4.EXP

jwasm -q -eq -mz TEXT32.ASM
jfc -t 0 TEXT32.ERR TEXT32.EXP

jwasm -q -Cu CASEMAP1.ASM
if errorlevel 1 goto :eof
jfc CASEMAP1.OBJ CASEMAP1.EXP

jwasm -q -eq -W3 INVOKE53.ASM
jfc INVOKE53.err INVOKE53.EXP

jwasm -q -eq -W3 OFFSET15.ASM
jfc OFFSET15.err OFFSET15.EXP
jwasm -q -eq -W3 OFFSET16.ASM
jfc OFFSET16.err OFFSET16.EXP
jwasm -q -eq -W3 INVLPG1.ASM
jfc INVLPG1.err INVLPG1.EXP
goto :eof



